package fr.mywiki.view.array.cell.entry;

import java.util.Date;

import fr.mywiki.business.entry.EntryLite;
import fr.mywiki.business.entry.EntryManager;
import fr.mywiki.business.utils.DateUtils;
import fr.mywiki.model.ejbAdapter.Value;
import fr.mywiki.view.array.cell.CellType;

/** Displays the last modification date of an entry. */
public class LastModifDateDisplayer implements CellType {
	public String compute(Value value) {
		try {
			Date date = EntryManager.getCurrentVersion((EntryLite) value).getDate();
			return DateUtils.formatDate(date);
		} catch (Exception e) {
			return new Date().toString();
		}
	}
}
